package com.demo.study.creative.d03_builder;

/**
 * @author Baymax
 * @since 2021/1/17
 */
public class PersonBuilder {
    private Person per = new Person();

    public PersonBuilder builderBase(String name, int age, String sex) {
        per.setName(name);
        per.setAge(age);
        per.setSex(sex);
        return this;
    }

    public PersonBuilder buildHobby(String play) {
        Hobby hobby = new Hobby(play);
        per.setHobby(hobby);
        return this;
    }

    public PersonBuilder buildAddress() {
        Address address = new Address();
        address.setProvince("安徽");
        address.setCity("合肥");
        per.setAddress(address);
        return this;
    }

    public Person build() {
        return per;
    }
}
